package persistence;

public class Volume {
	private int id;
	private int year;
	//Aufbewahrungsart, overrides setting for subscription, if set
	private PredefinedEntry kindOfStorage;
	private int volumeNumber;
	private Boolean isCurrentVolume;
	private Subscription subscription;
	private String notes;
	private BindingDetails bindingDetails;
	
	protected Volume() {}
	
	protected Volume (int id, int year, PredefinedEntry kindOfStorage, int volNo,
						Boolean isCurrentVol, Subscription sub, String notes, BindingDetails bd) {
		setId(id);
		setYear(year);
		setKindOfStorage(kindOfStorage);
		setVolumeNumber(volNo);
		setIsCurrentVolume(isCurrentVol);
		setSubscription(sub);
		setNotes(notes);
		setBindingDetails(bd);
	}	

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		result = prime * result
				+ ((subscription == null) ? 0 : subscription.hashCode());
		result = prime * result + volumeNumber;
		result = prime * result + year;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Volume other = (Volume) obj;
		if (id != other.id)
			return false;
		if (subscription == null) {
			if (other.subscription != null)
				return false;
		} else if (!subscription.equals(other.subscription))
			return false;
		if (volumeNumber != other.volumeNumber)
			return false;
		if (year != other.year)
			return false;
		return true;
	}

	public int getId() {
		return id;
	}

	public int getYear() {
		return year;
	}

	public PredefinedEntry getKindOfStorage() {
		return kindOfStorage;
	}

	public int getVolumeNumber() {
		return volumeNumber;
	}

	public Boolean getIsCurrentVolume() {
		return isCurrentVolume;
	}

	public Subscription getSubscription() {
		return subscription;
	}

	public String getNotes() {
		return notes;
	}
	
	public BindingDetails getBindingDetails() {
		return bindingDetails;
	}

	public void setId(int id) {
		this.id = id;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public void setKindOfStorage(PredefinedEntry kindOfStorage) {
		this.kindOfStorage = kindOfStorage;
	}

	public void setVolumeNumber(int volumeNumber) {
		this.volumeNumber = volumeNumber;
	}

	public void setIsCurrentVolume(Boolean isCurrentVolume) {
		this.isCurrentVolume = isCurrentVolume;
	}

	public void setSubscription(Subscription subscription) {
		this.subscription = subscription;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}	
	
	public void setBindingDetails (BindingDetails bd) {
		bindingDetails = bd;
	}
}